﻿using System;
using System.Threading.Tasks;

namespace AgileDevTool.Helpers
{
    public class TaskHelper
    {
        /// <summary>
        /// 用线程运行方法（带异常处理）
        /// </summary>
        /// <param name="action"></param>
        public static void RunUseThread(Action action)
        {
            Task.Run(() =>
            {
                try
                {
                    action?.Invoke();
                }
                catch (Exception ex)
                {
                    LogHelper.WriteError(ex.ToString());
                }
            });
        }
    }
}
